<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=0.45, user-scalable=yes">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
    <title></title>
</head>
<body>
<h2 id="headText" style="margin-left: 0.5%;margin-top: 0.3%"></h2>
<hr>
<div id="app">
    <div id="loginDiv" v-if="user.username === 'visitor'">
        <input type="button" class="btn btn-primary btn-sm" style="margin-left: 0.5%"
               onclick="location.href = '/CampusCats/login'" value="登录">
        <hr>
    </div>
    <div id="options" style="margin-left: 0.5%">
    <input type="button" class="btn btn-primary btn-sm"
           onclick="location.href = '/CampusCats/catsList'" value="查看所有猫咪">
    <input type="button" class="btn btn-primary btn-sm"
           onclick="location.href = '/CampusCats/records?type=appearance'"
           value="查看猫咪出现记录">
    <input type="button" class="btn btn-primary btn-sm"
           onclick="location.href = '/CampusCats/records?type=feeding'" value="查看猫咪投喂记录">
    <input type="button" class="btn btn-primary btn-sm" id="myRecordBtn" v-if="user.username !== 'visitor'"
           onclick="location.href = '/CampusCats/userRecords'" value="查看我的记录">
    <input type="button" id="logoutBtn" class="btn btn-primary btn-sm" v-if="user.username !== 'visitor'"
           onclick="location.href = '/CampusCats/logout'" value="注销">
    </div>
    <div id="adminOp" v-if="user.isAdmin">
        <hr>
        <input type="button" id="catCheck" class="btn btn-primary btn-sm" style="margin-left: 0.5%"
               onclick="location.href = '/CampusCats/adminCats'" value="猫咪添加审核">
        <input type="button" id="recordsCheck" class="btn btn-primary btn-sm"
               onclick="location.href = '/CampusCats/adminRecords'" value="记录提交审核">
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.13/vue.js"></script>
<script src="/CampusCats/js/userMsg.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            user: {}
        },
        async mounted() {
            this.user = await userMsg(" 的空间");
        }
    });
</script>
</body>
</html>